/*
 Navicat Premium Data Transfer

 Source Server         : mysql
 Source Server Type    : MySQL
 Source Server Version : 80039 (8.0.39)
 Source Host           : localhost:3306
 Source Schema         : ticket_system

 Target Server Type    : MySQL
 Target Server Version : 80039 (8.0.39)
 File Encoding         : 65001

 Date: 01/05/2025 12:53:26
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for feedbacks
-- ----------------------------
DROP TABLE IF EXISTS `feedbacks`;
CREATE TABLE `feedbacks` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `content` text NOT NULL COMMENT '反馈内容',
  `image_url` varchar(255) DEFAULT NULL COMMENT '图片URL',
  `reply` text COMMENT '回复内容',
  `status` enum('PENDING','REPLIED','CLOSED') NOT NULL DEFAULT 'PENDING' COMMENT '状态',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `replied_at` timestamp NULL DEFAULT NULL COMMENT '回复时间',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  CONSTRAINT `fk_feedbacks_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='反馈表';

-- ----------------------------
-- Records of feedbacks
-- ----------------------------
BEGIN;
INSERT INTO `feedbacks` (`id`, `user_id`, `content`, `image_url`, `reply`, `status`, `created_at`, `replied_at`) VALUES (1, 2, '票务处理太慢', 'c8a8dbec-a2df-4b84-a3bc-b324d907c95c.png', NULL, 'PENDING', '2025-04-30 08:53:17', NULL);
COMMIT;

-- ----------------------------
-- Table structure for forum_comments
-- ----------------------------
DROP TABLE IF EXISTS `forum_comments`;
CREATE TABLE `forum_comments` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `post_id` bigint NOT NULL COMMENT '帖子ID',
  `user_id` bigint NOT NULL COMMENT '评论用户ID',
  `content` text NOT NULL COMMENT '评论内容',
  `image_url` varchar(255) DEFAULT NULL COMMENT '图片URL',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_post_id` (`post_id`),
  KEY `idx_user_id` (`user_id`),
  CONSTRAINT `fk_forum_comments_post_id` FOREIGN KEY (`post_id`) REFERENCES `forum_posts` (`id`),
  CONSTRAINT `fk_forum_comments_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='帖子评论表';

-- ----------------------------
-- Records of forum_comments
-- ----------------------------
BEGIN;
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (1, 1, 1, '最后那个压哨三分确实惊艳，整个球馆都沸腾了', NULL, '2025-04-29 12:26:47');
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (2, 2, 1, '投篮姿势很重要，手型和出手点要保持一致', NULL, '2025-04-29 12:26:47');
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (3, 3, 1, '我也想参加，平时水平还可以，擅长打小前锋', NULL, '2025-04-29 12:26:47');
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (4, 4, 1, '奥拉朱旺的脚步真的无人能及', NULL, '2025-04-29 12:26:47');
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (5, 5, 1, '补充一下，建议避开周末晚上去打球，人太多了', NULL, '2025-04-29 12:26:47');
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (6, 1, 2, '1111', '', '2025-04-30 00:33:05');
INSERT INTO `forum_comments` (`id`, `post_id`, `user_id`, `content`, `image_url`, `created_at`) VALUES (7, 1, 2, '牛的牛的', '', '2025-04-30 01:44:02');
COMMIT;

-- ----------------------------
-- Table structure for forum_posts
-- ----------------------------
DROP TABLE IF EXISTS `forum_posts`;
CREATE TABLE `forum_posts` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT '发帖用户ID',
  `title` varchar(200) NOT NULL COMMENT '帖子标题',
  `content` text NOT NULL COMMENT '帖子内容',
  `image_url` varchar(255) DEFAULT NULL COMMENT '图片URL',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  CONSTRAINT `fk_forum_posts_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='论坛帖子表';

-- ----------------------------
-- Records of forum_posts
-- ----------------------------
BEGIN;
INSERT INTO `forum_posts` (`id`, `user_id`, `title`, `content`, `image_url`, `created_at`, `updated_at`) VALUES (1, 1, 'NBA季后赛精彩回顾', '昨晚的比赛真是太精彩了，最后时刻的绝杀让人热血沸腾！', NULL, '2025-04-29 12:26:47', '2025-04-29 12:26:47');
INSERT INTO `forum_posts` (`id`, `user_id`, `title`, `content`, `image_url`, `created_at`, `updated_at`) VALUES (2, 1, '篮球技术交流：如何提高三分球命中率', '分享一下我这段时间练习三分球的心得体会和技巧要领...', NULL, '2025-04-29 12:26:47', '2025-04-29 12:26:47');
INSERT INTO `forum_posts` (`id`, `user_id`, `title`, `content`, `image_url`, `created_at`, `updated_at`) VALUES (3, 1, '街球场寻找队友', '周末想约球，求靠谱队友，水平大概是业余联赛水平', NULL, '2025-04-29 12:26:47', '2025-04-29 12:26:47');
INSERT INTO `forum_posts` (`id`, `user_id`, `title`, `content`, `image_url`, `created_at`, `updated_at`) VALUES (4, 1, '讨论：谁是NBA历史最佳中锋', '从技术特点、比赛数据和荣誉成就来分析一下NBA历史上最出色的中锋...', NULL, '2025-04-29 12:26:47', '2025-04-29 12:26:47');
INSERT INTO `forum_posts` (`id`, `user_id`, `title`, `content`, `image_url`, `created_at`, `updated_at`) VALUES (5, 1, '分享：室内篮球馆推荐', '整理了一下本地比较好的室内篮球馆，包含场地情况和价格信息', NULL, '2025-04-29 12:26:47', '2025-04-29 12:26:47');
COMMIT;

-- ----------------------------
-- Table structure for matches
-- ----------------------------
DROP TABLE IF EXISTS `matches`;
CREATE TABLE `matches` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `venue_id` bigint NOT NULL COMMENT '场馆ID',
  `home_team_id` bigint NOT NULL COMMENT '主队ID',
  `away_team_id` bigint NOT NULL COMMENT '客队ID',
  `referee_id` bigint NOT NULL COMMENT '主裁判ID',
  `match_time` datetime NOT NULL COMMENT '比赛时间',
  `volunteer_ids` text COMMENT '志愿者ID列表 , 逗号分隔',
  `status` enum('SCHEDULED','ONGOING','FINISHED','CANCELLED') NOT NULL DEFAULT 'SCHEDULED' COMMENT '比赛状态',
  `home_score` int DEFAULT NULL COMMENT '主队得分',
  `away_score` int DEFAULT NULL COMMENT '客队得分',
  PRIMARY KEY (`id`),
  KEY `idx_venue_id` (`venue_id`),
  KEY `idx_home_team_id` (`home_team_id`),
  KEY `idx_away_team_id` (`away_team_id`),
  KEY `idx_referee_id` (`referee_id`),
  CONSTRAINT `fk_matches_away_team_id` FOREIGN KEY (`away_team_id`) REFERENCES `teams` (`id`),
  CONSTRAINT `fk_matches_home_team_id` FOREIGN KEY (`home_team_id`) REFERENCES `teams` (`id`),
  CONSTRAINT `fk_matches_referee_id` FOREIGN KEY (`referee_id`) REFERENCES `referees` (`id`),
  CONSTRAINT `fk_matches_venue_id` FOREIGN KEY (`venue_id`) REFERENCES `venues` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='比赛表';

-- ----------------------------
-- Records of matches
-- ----------------------------
BEGIN;
INSERT INTO `matches` (`id`, `venue_id`, `home_team_id`, `away_team_id`, `referee_id`, `match_time`, `volunteer_ids`, `status`, `home_score`, `away_score`) VALUES (1, 1, 2, 1, 1, '2025-06-01 10:00:00', '1', 'SCHEDULED', 90, 100);
COMMIT;

-- ----------------------------
-- Table structure for player_penalties
-- ----------------------------
DROP TABLE IF EXISTS `player_penalties`;
CREATE TABLE `player_penalties` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `match_id` bigint NOT NULL COMMENT '比赛ID',
  `player_id` bigint NOT NULL COMMENT '球员ID',
  `penalty_type` varchar(50) NOT NULL COMMENT '处罚类型',
  `description` text COMMENT '处罚描述',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_match_id` (`match_id`),
  KEY `idx_player_id` (`player_id`),
  CONSTRAINT `fk_player_penalties_match_id` FOREIGN KEY (`match_id`) REFERENCES `matches` (`id`),
  CONSTRAINT `fk_player_penalties_player_id` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='球员处罚记录表';

-- ----------------------------
-- Records of player_penalties
-- ----------------------------
BEGIN;
INSERT INTO `player_penalties` (`id`, `match_id`, `player_id`, `penalty_type`, `description`, `created_at`) VALUES (1, 1, 2, '黄牌', '1111', '2025-04-29 20:19:03');
COMMIT;

-- ----------------------------
-- Table structure for players
-- ----------------------------
DROP TABLE IF EXISTS `players`;
CREATE TABLE `players` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `team_id` bigint NOT NULL COMMENT '所属球队ID',
  `name` varchar(100) NOT NULL COMMENT '球员姓名',
  `number` int DEFAULT NULL COMMENT '球衣号码',
  `position` varchar(50) DEFAULT NULL COMMENT '场上位置',
  `photo_url` varchar(255) DEFAULT NULL COMMENT '照片URL',
  PRIMARY KEY (`id`),
  KEY `idx_team_id` (`team_id`),
  CONSTRAINT `fk_players_team_id` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='球员表';

-- ----------------------------
-- Records of players
-- ----------------------------
BEGIN;
INSERT INTO `players` (`id`, `team_id`, `name`, `number`, `position`, `photo_url`) VALUES (1, 1, '科比', 1, '控卫', '26381f66-8140-471b-9c79-38a00aec4d52.png');
INSERT INTO `players` (`id`, `team_id`, `name`, `number`, `position`, `photo_url`) VALUES (2, 2, '孙尚香', 1, '控卫', '282a27e6-11f9-4f3e-9d37-be7bdbd16c83.png');
COMMIT;

-- ----------------------------
-- Table structure for referees
-- ----------------------------
DROP TABLE IF EXISTS `referees`;
CREATE TABLE `referees` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL COMMENT '裁判姓名',
  `level` varchar(50) DEFAULT NULL COMMENT '裁判等级',
  `photo_url` varchar(255) DEFAULT NULL COMMENT '照片URL',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='裁判表';

-- ----------------------------
-- Records of referees
-- ----------------------------
BEGIN;
INSERT INTO `referees` (`id`, `name`, `level`, `photo_url`) VALUES (1, '李鹏', '国际级', '1941cf9a-250f-445d-9f8d-34a7808b6e47.png');
COMMIT;

-- ----------------------------
-- Table structure for seat_allocations
-- ----------------------------
DROP TABLE IF EXISTS `seat_allocations`;
CREATE TABLE `seat_allocations` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `match_id` bigint DEFAULT NULL,
  `section_id` bigint DEFAULT NULL,
  `seat_number` int DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=152 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of seat_allocations
-- ----------------------------
BEGIN;
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (1, 1, 1, 1, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (2, 1, 1, 2, 'RESERVED');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (3, 1, 1, 3, 'RESERVED');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (4, 1, 1, 4, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (5, 1, 1, 5, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (6, 1, 1, 6, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (7, 1, 1, 7, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (8, 1, 1, 8, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (9, 1, 1, 9, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (10, 1, 1, 10, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (11, 1, 1, 11, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (12, 1, 1, 12, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (13, 1, 1, 13, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (14, 1, 1, 14, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (15, 1, 1, 15, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (16, 1, 1, 16, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (17, 1, 1, 17, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (18, 1, 1, 18, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (19, 1, 1, 19, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (20, 1, 1, 20, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (21, 1, 1, 21, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (22, 1, 1, 22, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (23, 1, 1, 23, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (24, 1, 1, 24, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (25, 1, 1, 25, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (26, 1, 1, 26, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (27, 1, 1, 27, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (28, 1, 1, 28, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (29, 1, 1, 29, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (30, 1, 1, 30, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (31, 1, 1, 31, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (32, 1, 1, 32, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (33, 1, 1, 33, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (34, 1, 1, 34, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (35, 1, 1, 35, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (36, 1, 1, 36, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (37, 1, 1, 37, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (38, 1, 1, 38, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (39, 1, 1, 39, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (40, 1, 1, 40, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (41, 1, 1, 41, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (42, 1, 1, 42, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (43, 1, 1, 43, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (44, 1, 1, 44, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (45, 1, 1, 45, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (46, 1, 1, 46, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (47, 1, 1, 47, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (48, 1, 1, 48, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (49, 1, 1, 49, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (50, 1, 1, 50, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (51, 1, 1, 51, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (52, 1, 1, 52, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (53, 1, 1, 53, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (54, 1, 1, 54, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (55, 1, 1, 55, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (56, 1, 1, 56, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (57, 1, 1, 57, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (58, 1, 1, 58, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (59, 1, 1, 59, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (60, 1, 1, 60, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (61, 1, 1, 61, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (62, 1, 1, 62, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (63, 1, 1, 63, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (64, 1, 1, 64, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (65, 1, 1, 65, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (66, 1, 1, 66, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (67, 1, 1, 67, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (68, 1, 1, 68, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (69, 1, 1, 69, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (70, 1, 1, 70, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (71, 1, 1, 71, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (72, 1, 1, 72, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (73, 1, 1, 73, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (74, 1, 1, 74, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (75, 1, 1, 75, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (76, 1, 1, 76, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (77, 1, 1, 77, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (78, 1, 1, 78, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (79, 1, 1, 79, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (80, 1, 1, 80, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (81, 1, 1, 81, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (82, 1, 1, 82, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (83, 1, 1, 83, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (84, 1, 1, 84, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (85, 1, 1, 85, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (86, 1, 1, 86, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (87, 1, 1, 87, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (88, 1, 1, 88, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (89, 1, 1, 89, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (90, 1, 1, 90, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (91, 1, 1, 91, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (92, 1, 1, 92, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (93, 1, 1, 93, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (94, 1, 1, 94, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (95, 1, 1, 95, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (96, 1, 1, 96, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (97, 1, 1, 97, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (98, 1, 1, 98, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (99, 1, 1, 99, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (100, 1, 1, 100, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (101, 1, 2, 1, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (102, 1, 2, 2, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (103, 1, 2, 3, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (104, 1, 2, 4, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (105, 1, 2, 5, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (106, 1, 2, 6, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (107, 1, 2, 7, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (108, 1, 2, 8, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (109, 1, 2, 9, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (110, 1, 2, 10, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (111, 1, 2, 11, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (112, 1, 2, 12, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (113, 1, 2, 13, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (114, 1, 2, 14, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (115, 1, 2, 15, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (116, 1, 2, 16, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (117, 1, 2, 17, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (118, 1, 2, 18, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (119, 1, 2, 19, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (120, 1, 2, 20, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (121, 1, 2, 21, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (122, 1, 2, 22, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (123, 1, 2, 23, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (124, 1, 2, 24, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (125, 1, 2, 25, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (126, 1, 2, 26, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (127, 1, 2, 27, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (128, 1, 2, 28, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (129, 1, 2, 29, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (130, 1, 2, 30, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (131, 1, 2, 31, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (132, 1, 2, 32, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (133, 1, 2, 33, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (134, 1, 2, 34, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (135, 1, 2, 35, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (136, 1, 2, 36, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (137, 1, 2, 37, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (138, 1, 2, 38, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (139, 1, 2, 39, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (140, 1, 2, 40, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (141, 1, 2, 41, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (142, 1, 2, 42, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (143, 1, 2, 43, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (144, 1, 2, 44, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (145, 1, 2, 45, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (146, 1, 2, 46, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (147, 1, 2, 47, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (148, 1, 2, 48, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (149, 1, 2, 49, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (150, 1, 2, 50, 'AVAILABLE');
INSERT INTO `seat_allocations` (`id`, `match_id`, `section_id`, `seat_number`, `status`) VALUES (151, 1, 3, 1, 'RESERVED');
COMMIT;

-- ----------------------------
-- Table structure for teams
-- ----------------------------
DROP TABLE IF EXISTS `teams`;
CREATE TABLE `teams` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL COMMENT '球队名称',
  `logo_url` varchar(255) DEFAULT NULL COMMENT '球队logo URL',
  `description` text COMMENT '球队描述',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='球队表';

-- ----------------------------
-- Records of teams
-- ----------------------------
BEGIN;
INSERT INTO `teams` (`id`, `name`, `logo_url`, `description`) VALUES (1, '热火少年', '9f6a72e2-d1e9-4b32-859d-30fa74350969.png', '热火少年冲冲冲');
INSERT INTO `teams` (`id`, `name`, `logo_url`, `description`) VALUES (2, '福气多多', '51bf3eb2-db92-4d49-863c-bccef2122e91.png', '福气多多代表队');
COMMIT;

-- ----------------------------
-- Table structure for ticket_orders
-- ----------------------------
DROP TABLE IF EXISTS `ticket_orders`;
CREATE TABLE `ticket_orders` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `match_id` bigint NOT NULL COMMENT '比赛ID',
  `section_id` bigint NOT NULL COMMENT '看台区域ID',
  `ticket_number` int NOT NULL COMMENT '票号',
  `total_amount` decimal(10,2) NOT NULL COMMENT '总金额',
  `status` enum('PENDING','PAID','CANCELLED','REFUNDED') NOT NULL DEFAULT 'PENDING' COMMENT '订单状态',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `paid_at` timestamp NULL DEFAULT NULL COMMENT '支付时间',
  `name` varchar(50) DEFAULT NULL COMMENT '姓名',
  `phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_match_id` (`match_id`),
  CONSTRAINT `fk_ticket_orders_match_id` FOREIGN KEY (`match_id`) REFERENCES `matches` (`id`),
  CONSTRAINT `fk_ticket_orders_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订票表';

-- ----------------------------
-- Records of ticket_orders
-- ----------------------------
BEGIN;
INSERT INTO `ticket_orders` (`id`, `user_id`, `match_id`, `section_id`, `ticket_number`, `total_amount`, `status`, `created_at`, `paid_at`, `name`, `phone`, `email`) VALUES (1, 2, 1, 1, 1, 50.00, 'REFUNDED', '2025-04-29 22:21:32', '2025-04-29 22:21:32', NULL, NULL, NULL);
INSERT INTO `ticket_orders` (`id`, `user_id`, `match_id`, `section_id`, `ticket_number`, `total_amount`, `status`, `created_at`, `paid_at`, `name`, `phone`, `email`) VALUES (2, 2, 1, 2, 1, 10.00, 'REFUNDED', '2025-04-29 22:26:18', '2025-04-29 22:26:18', NULL, NULL, NULL);
INSERT INTO `ticket_orders` (`id`, `user_id`, `match_id`, `section_id`, `ticket_number`, `total_amount`, `status`, `created_at`, `paid_at`, `name`, `phone`, `email`) VALUES (3, 2, 1, 1, 2, 50.00, 'PAID', '2025-04-29 14:42:43', '2025-04-29 22:42:44', '李飞飞', '17721231234', '123476@qq.com');
INSERT INTO `ticket_orders` (`id`, `user_id`, `match_id`, `section_id`, `ticket_number`, `total_amount`, `status`, `created_at`, `paid_at`, `name`, `phone`, `email`) VALUES (4, 2, 1, 1, 3, 50.00, 'PAID', '2025-04-29 14:56:37', '2025-04-29 22:56:38', 'lifeifei', '17801231234', '123490@qq.com');
INSERT INTO `ticket_orders` (`id`, `user_id`, `match_id`, `section_id`, `ticket_number`, `total_amount`, `status`, `created_at`, `paid_at`, `name`, `phone`, `email`) VALUES (5, 2, 1, 3, 1, 500.00, 'REFUNDED', '2025-04-30 09:43:43', '2025-04-30 09:43:43', '测试', '17801212314', '12349@qq.com');
COMMIT;

-- ----------------------------
-- Table structure for ticket_prices
-- ----------------------------
DROP TABLE IF EXISTS `ticket_prices`;
CREATE TABLE `ticket_prices` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `match_id` bigint NOT NULL COMMENT '比赛ID',
  `section_id` bigint NOT NULL COMMENT '看台区域ID',
  `price` decimal(10,2) NOT NULL COMMENT '票价',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_match_section` (`match_id`,`section_id`),
  KEY `idx_section_id` (`section_id`),
  CONSTRAINT `fk_ticket_prices_match_id` FOREIGN KEY (`match_id`) REFERENCES `matches` (`id`),
  CONSTRAINT `fk_ticket_prices_section_id` FOREIGN KEY (`section_id`) REFERENCES `venue_sections` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='票价表';

-- ----------------------------
-- Records of ticket_prices
-- ----------------------------
BEGIN;
INSERT INTO `ticket_prices` (`id`, `match_id`, `section_id`, `price`) VALUES (4, 1, 1, 50.00);
INSERT INTO `ticket_prices` (`id`, `match_id`, `section_id`, `price`) VALUES (5, 1, 2, 10.00);
INSERT INTO `ticket_prices` (`id`, `match_id`, `section_id`, `price`) VALUES (6, 1, 3, 500.00);
COMMIT;

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL COMMENT '用户名',
  `password` varchar(255) NOT NULL COMMENT '密码',
  `email` varchar(100) NOT NULL COMMENT '邮箱',
  `phone` varchar(20) DEFAULT NULL COMMENT '手机号',
  `role` enum('USER','ADMIN') NOT NULL DEFAULT 'USER' COMMENT '用户角色',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `avatar_url` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_username` (`username`),
  UNIQUE KEY `uk_email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';

-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
INSERT INTO `users` (`id`, `username`, `password`, `email`, `phone`, `role`, `created_at`, `updated_at`, `avatar_url`) VALUES (1, 'admin', '$2a$10$oBP9wGqrnl.ygxLKDedALuLXuKEO0H9wMhzuy/.t4ZKwqkGzC18hK', '12435687@qq.com', '17801231234', 'ADMIN', '2025-04-29 19:22:07', '2025-04-30 00:35:15', 'default.jpg');
INSERT INTO `users` (`id`, `username`, `password`, `email`, `phone`, `role`, `created_at`, `updated_at`, `avatar_url`) VALUES (2, 'user', '$2a$10$Ugvz0rIV.sxjAalXqdFx2Odq0xDVCjOw8bao2DPMtwUzQ3pLfRRTq', '1234567@qq.com', '17801231234', 'USER', '2025-04-29 21:35:36', '2025-04-30 00:35:16', 'd9d5ff14-1981-4697-8876-ea07ac30000e.png');
COMMIT;

-- ----------------------------
-- Table structure for venue_sections
-- ----------------------------
DROP TABLE IF EXISTS `venue_sections`;
CREATE TABLE `venue_sections` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `venue_id` bigint NOT NULL COMMENT '场馆ID',
  `section_number` int NOT NULL COMMENT '区域编号',
  `name` varchar(50) NOT NULL COMMENT '区域名称',
  `capacity` int NOT NULL COMMENT '座位容量',
  PRIMARY KEY (`id`),
  KEY `idx_venue_id` (`venue_id`),
  CONSTRAINT `fk_venue_sections_venue_id` FOREIGN KEY (`venue_id`) REFERENCES `venues` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='看台区域表';

-- ----------------------------
-- Records of venue_sections
-- ----------------------------
BEGIN;
INSERT INTO `venue_sections` (`id`, `venue_id`, `section_number`, `name`, `capacity`) VALUES (1, 1, 1, 'A区', 100);
INSERT INTO `venue_sections` (`id`, `venue_id`, `section_number`, `name`, `capacity`) VALUES (2, 1, 2, 'B区', 50);
INSERT INTO `venue_sections` (`id`, `venue_id`, `section_number`, `name`, `capacity`) VALUES (3, 1, 3, 'VIP', 30);
COMMIT;

-- ----------------------------
-- Table structure for venues
-- ----------------------------
DROP TABLE IF EXISTS `venues`;
CREATE TABLE `venues` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL COMMENT '场馆名称',
  `city` varchar(50) NOT NULL COMMENT '城市',
  `address` varchar(255) NOT NULL COMMENT '详细地址',
  `image_url` varchar(255) DEFAULT NULL COMMENT '场馆图片URL',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='场馆表';

-- ----------------------------
-- Records of venues
-- ----------------------------
BEGIN;
INSERT INTO `venues` (`id`, `name`, `city`, `address`, `image_url`, `created_at`) VALUES (1, '村BA一号馆', '郑州', '郑州市金水区测试区域', 'a718d3d5-f9c0-4192-8b4b-2046d3fb23d3.jpg', '2025-04-29 19:29:37');
COMMIT;

-- ----------------------------
-- Table structure for volunteers
-- ----------------------------
DROP TABLE IF EXISTS `volunteers`;
CREATE TABLE `volunteers` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL COMMENT '志愿者姓名',
  `phone` varchar(20) NOT NULL COMMENT '联系电话',
  `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='志愿者表';

-- ----------------------------
-- Records of volunteers
-- ----------------------------
BEGIN;
INSERT INTO `volunteers` (`id`, `name`, `phone`, `email`) VALUES (1, '李飞飞', '17801231234', '123687@qq.com');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
